﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _16.FindSumInnumay
{
    class FindSumInArray
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Which sum:=");
            int sum = int.Parse(Console.ReadLine());
            Console.WriteLine("n of num=");
            int n = int.Parse(Console.ReadLine());

            int[] num = new int[n];
            for (int i = 0; i < n; i++)
            {
                Console.Write("numbers[{0}]: ", i);
                num[i] = int.Parse(Console.ReadLine());
            }

            for (int i = 0; i < num.Length-2; i++)
            {
                if (num[i] + num[i+1] + num[i+2] == sum)
                {
                    Console.WriteLine("<{0}(index={4}), {1}(index={5}), {2}(index={6})> = {3}", num[i], num[i + 1], num[i + 2], sum, i, i + 1, i+2);
                }
            }
        }
    }
}